﻿#region [     文件信息     ]

/*----------------------------------------------------------------
 * CLR版本：4.0.30319.42000
 * 机器名称：VAMPIREWAL
 * 公司名称：Organization
 * 命名空间：Vampirewal.Core.FlowEngine.Interface
 * 唯一标识：2044393b-8bd0-45bd-9b41-e17a344907d1
 * 文件名：IWorkFlowEngine
 * 当前用户域：VAMPIREWAL
 *
 * 创建者：Administrator
 * 电子邮箱：235160615@qq.com
 * 创建时间：2023/8/9 13:30:16
 * 版本：V1.0.0
 * 描述：
 *
 * ----------------------------------------------------------------
 * 修改人：
 * 时间：
 * 修改说明：
 *
 * 版本：V1.0.1
 *----------------------------------------------------------------*/

#endregion [     文件信息     ]

global using Microsoft.Extensions.DependencyInjection;
global using System.Collections.Generic;
global using System.Text.Json;
global using Vampirewal.Core.Components;
global using Vampirewal.Core.Models.FlowEngine;

namespace Vampirewal.Core.FlowEngine;

/// <summary>
/// 流程引擎服务接口基类
/// </summary>
public interface IVampirewalWorkFlowEngine
{
    /// <summary>
    /// 判断工作流程是否结束
    /// </summary>
    /// <param name="WorkId"></param>
    /// <returns></returns>
    Task<bool> WorkIsComplate(string WorkId);
}

/// <summary>
/// 流程引擎服务客户端
/// </summary>
public interface IVampirewalWorkFlowEngineClient : IVampirewalWorkFlowEngine
{
    /// <summary>
    /// 提交流程
    /// </summary>
    /// <param name="FlowType"></param>
    /// <param name="Params"></param>
    void Commit(string FlowType, WorkParamCollection Params);

    /// <summary>
    /// 审核
    /// </summary>
    /// <param name="WorkId"></param>
    /// <param name="Params"></param>
    void Audit(string WorkId, WorkParamCollection Params);

    /// <summary>
    /// 撤回审核
    /// </summary>
    /// <param name="WorkId"></param>
    /// <param name="Params"></param>
    void UnDoAudit(string WorkId, WorkParamCollection Params);

    /// <summary>
    /// 作废流程
    /// </summary>
    /// <param name="WorkId"></param>
    /// <param name="Params"></param>
    void Abolish(string WorkId, WorkParamCollection Params);
}

/// <summary>
/// 流程引擎服务端
/// </summary>
public interface IVampirewalWorkFlowEngineServer : IVampirewalWorkFlowEngine
{
    /// <summary>
    /// 开启工作流程
    /// </summary>
    /// <param name="FlowType"></param>
    /// <param name="Params"></param>
    /// <returns>WorkId</returns>
    Task<string> StartWork(int FlowType, WorkParamCollection Params);

    /// <summary>
    /// 任务节点执行完成
    /// </summary>
    /// <param name="WorkId"></param>
    /// <param name="IsPass"></param>
    /// <param name="Opinion"></param>
    /// <param name="Params"></param>
    Task TaskRun(string WorkId, bool IsPass, string Opinion, WorkParamCollection Params);
}